import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useRoleStore = defineStore('role', () => {
  const selectedRole = ref(null)
  const isRoleSelected = ref(false)

  const setSelectedRole = (role) => {
    selectedRole.value = role
    isRoleSelected.value = true
  }

  const clearSelectedRole = () => {
    selectedRole.value = null
    isRoleSelected.value = false
  }

  return {
    selectedRole,
    isRoleSelected,
    setSelectedRole,
    clearSelectedRole
  }
})